package it.mf.eclipseutils;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;

public class WorkspaceTool {
	public static IProject getProject(String projectName)
	{
		IWorkspaceRoot wrkSpcRoot;
		
		try
		{
			wrkSpcRoot=getWorkspaceRoot();
			return wrkSpcRoot.getProject(projectName);
		}
		catch(Exception e)
		{
			return null;
		}
	}
	
	public static IWorkspaceRoot getWorkspaceRoot()
	{
		IWorkspace workspace;
				
		try
		{
			workspace=ResourcesPlugin.getWorkspace();
			return workspace.getRoot();
		}
		catch(Exception e )
		{
			return null;
		}
	}
}
